﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Web;
using System.Text;
using System.Threading.Tasks;

namespace WcfBusinessLogic
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the interface name "IService1" in both code and config file together.
    [ServiceContract]
    public interface IBusinessLogic
    {
        [OperationContract]
        void SendCommand(string name, string message);
        
        [OperationContract]
        UserDetails LogIn(UserDetails aUser);

        [OperationContract]
        void LogOut(UserDetails aUser);

        [OperationContract]
        string Register(UserDetails aUser);

        [OperationContract]
        void ConnectCharacter(string characterID);

        [OperationContract]
        CharacterInFo[] GetCharacters(string userID);

        [OperationContract]
        string SaveCharacter(CharacterInFo character);

        [OperationContract]
        GameNews[] GetNews();

        [OperationContract]
        void NewNews(GameNews someNews);

        [OperationContract]
        void DeleteNews(GameNews someNews);
        
        // TODO: Add your service operations here
    }


    // Use a data contract as illustrated in the sample below to add composite types to service operations.
    [DataContract]
    public class CharacterInFo
    {
        //need to set the rest of a characters information 
        //client will need it for editing/creating characters
        int userID = 0;
        int charID = 0;
        string charName = "";
        string charDescription = "";
        int maxHP = 0;
        int maxMP = 0;
        int str = 0;
        int dex = 0;
        int intel = 0;

        [DataMember]
        public int UserID
        {
            get { return userID; }
            set { userID = value; }
        }

        [DataMember]
        public int CharID
        {
            get { return charID; }
            set { charID = value; }
        }

        [DataMember]
        public string CharName
        {
            get { return charName; }
            set { charName = value; }
        }
        [DataMember]
        public string CharDescription
        {
            get { return charDescription; }
            set { charDescription = value; }
        }
        [DataMember]
        public int CharHP
        {
            get { return maxHP; }
            set { maxHP = value; }
        }
        [DataMember]
        public int CharMP
        {
            get { return maxMP; }
            set { maxMP = value; }
        }
        [DataMember]
        public int CharStr
        {
            get { return str; }
            set { str = value; }
        }
        [DataMember]
        public int CharDex
        {
            get { return dex; }
            set { dex = value; }
        }
        [DataMember]
        public int CharInt
        {
            get { return intel; }
            set { intel = value; }
        }
    }
    [DataContract]
    public class UserDetails
    {
        int userID = 0;
        string userName = "";
        string email = "";
        string userKey = "";
        [DataMember]
        public int UserID
        {
            get { return userID; }
            set { userID = value; }
        }
        [DataMember]
        public string UserName
        {
            get { return userName; }
            set { userName = value; }
        }
        [DataMember]
        public string Email
        {
            get { return email; }
            set { email = value; }
        }
        [DataMember]
        public string UserKey
        {
            get {  return userKey; }
            set { userKey = value; }
        }
    }
    [DataContract]
    public class GameNews
    {
        string headline = "";
        string date = "";
        string details = "";
        
        [DataMember]
        public string Headline
        {
            get { return headline; }
            set { headline = value; }
        }
        [DataMember]
        public string Date
        {
            get { return date; }
            set { date = value; }
        }
        [DataMember]
        public string Details
        {
            get { return details; }
            set { details = value; }
        }
    }
}
